#include "ADTDll.h"

namespace ADTHandle
{
	bool ADT::CreateADT()
	{
		h2o_h.resize(256);
		h2o_i.resize(256);
		h2o_r.resize(256);
		cnk.resize(256);
		cvt.resize(256);
		cse.resize(256);

		ver = adt_C.FillMVER();
		hdr = adt_C.FillMHDR();
		h2o = adt_C.FillMH2O();
		for(int i = 0; i < 256; ++i)
		{
			h2o_h[i] = adt_C.FillMH2O_H();
			h2o_i[i] = adt_C.FillMH2O_I();
			h2o_r[i] = adt_C.FillMH2O_R();
			cnk[i] = adt_C.FillMCNK();
			cvt[i] = adt_C.FillMCVT();
			cse[i] = adt_C.FillMCSE();
		}
		fbo = adt_C.FillMFBO();

		//Streamout is needed.
		strm >> ver;
		strm >> hdr;
		strm >> h2o;
		//MH2O-Subchunks
		for(int i = 0; i < 256; ++i)
			strm >> h2o_h[i];

		for(int i = 0; i < 256; ++i)
			strm >> h2o_i[i];

		for(int i = 0; i < 256; ++i)
			for(int j  = 0; j < 8; ++j)
				strm >> h2o_r[i].Render[j];
		//MCNK
		for(int i = 0; i < 256; ++i)
		{
			strm >> cnk[i];
			strm >> cvt[i];
			strm >> cse[i];
		}
		strm >> fbo;

		return true;
	}
}